#ifndef OA_CORE_CONFIG_H
#define OA_CORE_CONFIG_H

#include "libs.h"
#include "util.h"
#include "core/log.h"
#include "core/system.h"

namespace core {
	class _OA_export Config:
		public System
	{
	public:
		Config();
		virtual ~Config();
		
		bool load(const std::string& name);
		void parseCommandLine(int argc, char* argv[]);

		bool isSet(const std::string& name) const;

		boost::program_options::options_description& settings();

		template <typename T>
		T get(const std::string& name) const;

	private:
		boost::program_options::options_description mOptions;
		boost::program_options::variables_map mVariables;
	};

	template <typename T>
	T Config::get(const std::string& name) const {
		if (isSet(name)) {
			return mVariables[name.c_str()].as<T>();
		}
		else {
			mLog << "Failed to find variable: " << name;
			return T();
		}
	}
}

#endif
